package com.qk.common.exception;

import com.qk.common.enums.Code;

public class CommonException extends BaseException {
    private Code code;

    public CommonException(Code code) {
        super(code.getCode(), code.getMsg());
        this.code = code;
    }

    public CommonException(Code code, Throwable cause) {
        super(code.getCode(), code.getMsg(), cause);
        this.code = code;
    }

    public static void throwCommonException(Code code) {
        throw new CommonException(code);
    }

    public static void throwCommonException(Code code, Throwable cause) {
        throw new CommonException(code, cause);
    }

    public Code getCode() {
        return code;
    }
}
